home *** CD-ROM | disk | FTP | other *** search
- Path: nntp1.best.com!zenin
- From: Zenin <zenin@best.com>
- Newsgroups: comp.lang.c
- Subject: Re: Limiting stdin input to "n" chars
- Date: 23 Mar 1996 19:06:17 GMT
- Organization: Rocky Horror, Barely Legal (Berkeley, CA)
- Message-ID: <4j1i39$jso@nntp1.best.com>
- References: <4hqfmc$un7@thorn.cc.usm.edu> <4icer1$df5@altrade.nijmegen.inter.nl.net> <4if7k6$9ro@news.xs4all.nl>
- NNTP-Posting-Host: shellx.best.com
-
- Falstaff <falstaff@xs4all.nl> wrote:
- >snip<
- : No won't work. fgets() uses the standard I/O library which will
- : wait for a linefeed anyway.
-
- I'm having similar problems. So just how does one just grap the
- first char (or n chars) and move on without needing the line feed?
-
- What I'm trying to do is simply ask a y/n question of the user so
- that they only have to enter "y" or "n" without having to also give
- the anoying line feed.
-
- If this is not part of the std lib somewere, someone out there
- /must/ (assuming, danger!) have writen a function to do this...?
-
- I thought simply
- int c;
- c = getchar();
- if (c ==...etc...
- would do it, but of course I'm wrong... :(
-
- TIA!
- ______
- / Spelling mistakes? Their couldn't be. -My modem is error correcting.
- /
- / Zenin@Best.com ---->>ROCKY HORROR ARCHIVE<<----
- / ___ __ o __
- / /___\ |/ \ | |/ \ http://www.best.com/~zenin/
- /_______\___ | | | | |_______________________________________________
-